namespace array_demo.Model.Set
{
    public class SortArraySet1<Key> : ISet<Key> where Key : IComparable<Key>
    {
        private SortArray1<Key> array;

        public SortArraySet1()
        {
            array = new SortArray1<Key>();
        }

        public SortArraySet1(int capacity)
        {
            array = new SortArray1<Key>(capacity);
        }

        public bool IsEmpty => array.IsEmpty;

        public int Count => array.Count;

        public void Add(Key e)
        {
            if (!array.Contains(e))
                array.Add(e);
        }

        public bool Contains(Key e)
        {
            return array.Contains(e);
        }

        public void Remove(Key e)
        {
            array.Remove(e);
        }
    }
}